package uk.ac.glasgow.demosocs.impl.ui;

import java.text.DateFormat;
import java.text.ParseException;
import java.util.Date;
import java.util.Locale;

import uk.ac.glasgow.clui.SystemCommandException;

public class DateUtil {
	
	// Changed this
	private static DateFormat df = DateFormat.getDateInstance(3,Locale.UK);
	// Now, the format for creating an election is
	// create election type 09/09/09 12:50pm 09/09/08 11:00pm 09/09/10 11:00pm 1111
	
	
	public static Date parseArgumentDate(String day, String time) throws SystemCommandException {
		
		String dateString = day+" "+time;
		try {
			return df.parse(dateString);
		} catch (ParseException e) {
			throw new SystemCommandException("Couldn't parse date string: ["+dateString+"]");
		}
	}
}
